﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="News.aspx.cs" Inherits="Sbook.News" %>

<%@ Register Src="~/Control/Menu/MenuTop.ascx"  TagName="MenuTop" TagPrefix="UC" %>
<%@ Register Src="~/Control/Menu/MenuRight.ascx"  TagName="MenuRight" TagPrefix="UC" %>


<%@ Register src="Control/Menu/Menu_News.ascx" tagname="Menu_News" tagprefix="uc1" %>


<%@ Register assembly="CollectionPager" namespace="SiteUtils" tagprefix="cc1" %>





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>News</title>
<script type="text/javascript" src="/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.simplyscroll.js"></script>
<link type="text/css" rel="stylesheet" href="/css/style_dssp_menuright.css" />
<script type="text/javascript">
    $(document).ready(function () {
        $(".menu_top li").hover(function () {
            $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(500)
        }, function () {
            $(this).find('ul:first').css({ visibility: "hidden" })
        });
    });
</script>
<style type="text/css">

a.title:link, a.title:visited
{
color:#00B8A5;
text-decoration:none;
 font-size:x-large;
}
 
a.title:hover
{
color:Gray;
text-decoration:none;
}

a.Group:link, a.Group:visited
{
  color:#33CCFF; 
  text-decoration:none;
  font-size:x-large; 
  text-align:left;    
}

a.Group:hover
{
    text-decoration:underline;
    
}
</style>
</head>

<body>
    <form id="form1" runat="server">
<center>
<!-- web -->
<div class="web">
	<div class="header">
    	<!-- logo --> 
    	<div class="logo">
            	<a href="/index.aspx"><img alt="" src="/images/logo_sach.gif" width="158" height="161" /></a>
    	</div>
        <!-- close logo --> 
        <!-- header_top --> 
        <div class="header_top">
        	<!-- menu_top --> 
	    	<UC:MenuTop runat="server" ID="Menu1"></UC:MenuTop>
            <!-- close menu_top --> 
            <!-- hỗ trợ trực tuyến --> 
            <div class="hotrotructuyen">
        		<a href="ymsgr:sendIM?huy_xda_pm1&amp;m=Chào bạn!"><img alt="" src=http://mail.opi.yahoo.com/online?u=huy_xda_pm1&amp;m=g&amp;t=2 vspace=0 width="121" height="34" /></a>
            	<a href="#"><img alt=""  width="121" height="34" /></a>
        	</div>
            <!-- close hỗ trợ trực tuyến --> 
            <!-- search --> 
            <div class="search">
                	<input type="text" name="txtsearch" style="width:250px; height:20px; border-radius: 5px;" value="Tìm kiếm..." onfocus="if(this.value=='Tìm kiếm...')this.value='';" onblur="if(this.value=='')this.value='Tìm kiếm...';"/>
                    <input type="submit" name="btsearch" value="Theo tên, tác giả" style="height:25px;" />
                </div>
            <!-- close search --> 
        </div>
        <!-- close header_top --> 
    </div>
    
<!-- danh sách sản phẩm -->
<div class="chitietsp">
    	<!-- tiêu đề sản phẩm bán chạy --> 
        <br />
        <h1>
          <asp:Label ID="lblTitleTop" runat="server" Text="Tin mới nhất" ></asp:Label>
        </h1>
        <br /><br />
    	<!-- sản phẩm item -->
    <asp:DataList ID="dtlNews" runat="server" >
        <ItemTemplate>
            <table style="width:100%;">
                <tr>
                    <td>
                        <a class="title" href='/News/<%# Eval("NId")%>.aspx'><%# Eval("NTitle") %></a></td>
                </tr>
               
                <tr>
                    <td>
                    <div style="float:left;padding-right:5px">
                        <asp:Image ID="Image1" runat="server" 
                             Width="180px" Height="145px" 
                            ImageUrl='<%# Eval("Image") %>'  /></div>
                        <div><asp:Label ID="Label2" runat="server" Text='<%# Eval("NDescription") %>' 
                            Font-Bold="True" Font-Size="Large"></asp:Label> </td></div>
                </tr>
                <tr>
                    <td>
                      <asp:Label ID="Label3" runat="server" Text='<%# Eval("NId") %>' Visible="False"></asp:Label> <br /><br /> </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:DataList>
    <br /><br />
    <cc1:CollectionPager ID="clPager" runat="server" BackNextDisplay="HyperLinks" 
            BackNextLocation="None" BackText="« Back" LabelText="" 
            PageNumbersDisplay="Numbers" QueryStringKey="Page" ShowFirstLast="True" 
            ResultsFormat="">
    </cc1:CollectionPager>
        <!-- close sản phẩm item-->
</div>
<!-- close danh sách sản phẩm -->

<!-- right -->
<div class="right">
	<!-- danh mục phải -->
	<div class="menu_right" style="width:200px; padding-left:35px; margin-left:0px; text-align:left">
    	
        <script type="text/javascript">
            $(document).ready(function () {
                $("div.right div.menu_right ul:not(first)").hide();
                $('ul#f1').show();
                $('h2.menu_head').click(function () {

                    $('.active').removeClass('active');
                    $(this).addClass('active');
                    $('ul').slideUp('slow');
                    $(this).next('ul').slideDown('slow');
                    var content_show = $(this).attr('title');
                    $('#' + content_show).slideDown('slow');

                });
            });
		</script>
     
        
        <uc1:Menu_News ID="Menu_News1" runat="server" />
     
        
    </div>
    <!-- close danh mục phải -->
</div>
<!-- close right -->
<!-- footer --> 
<div class="footer">
</div>
<!-- close footer -->
    
</div>

<!-- close web -->

<style>
    #divChangePass{ width:500px; height:235px; position:absolute; display:none; background-color:White; border:1px solid #CCFFFF; left:385px; top:160px; z-index:1000}
    #divChangePass ul { float:left; width:100%; list-style:none;}
    #divChangePass ul li{ float:left; width:100%; margin-top:10px;}
    #divChangePass ul li span{ color:Red; display:none}
    #divChangePass ul li label{ float:left; width:200px; text-align:right; padding-right:5px;}
    #divChangePass ul li input[type=password]{ float:left;}
    #divChangePass h1{ color:Red; font-size:25px}
    #divChangePass a{ float:right; margin:0px 0px; padding:0px 0px }
</style>
<div id="divChangePass">
    <a href="#" id="closeChangePass">X</a>
    <form id="frm2">
        <h1>Đổi mật khẩu</h1>
        <ul>
            <li><label>Mật khẩu cũ:</label> <input type="password" id="txtOldPass" /><span id="spOldPass">Không được để trống.</span></li>
            <li><label>Mật khẩu mới:</label> <input type="password" id="txtNewPass" /><span id="spNewPass">Không được để trống.</span></li>
            <li><label>Xác nhận mật khẩu mới:</label> <input type="password" id="txtRePass" /><span id="spRePass">Không được để trống.</span></li>
            <li><input type="button" value="Đổi mật khẩu" id="btnChangePass" /></li>
        </ul>
    </form>
    <script type="text/javascript">
        $(document).ready(function () {
            var isLogin = $('#login').html();
            if (isLogin == "Đăng nhập") {
                $('#logout').hide();
                $('#Close').click(function () {
                    $('#divlogin').toggle(1000);
                });
                $('#login').click(function () {
                    $('#divlogin').toggle(1000);
                    $('#divDoiMK').css("display", "none");
                });
            }
            else {
                $('#logout').show();
                //                        $('#login').attr("href", "http://hn.24h.com.vn");
                $('#login').click(function () {

                    $('#divDoiMK').toggle(1000);
                });
                $('#CloseDMK').click(function () {
                    $('#divDoiMK').toggle(1000);
                });
            }


            $('#dangnhap').click(function () {

                var user = $('#user').val();
                var pass = $('#pass').val();

                window.location.href = "Demo.aspx?user=" + user + "&pass=" + pass;

            });
            //             Click đổi mật khẩu

            $('a#aDoiMK').click(function () {

                $('div.web').css("opacity", "0.25");
                $('div#divChangePass').css("display", "block");

                $('#divDoiMK').toggle(1000);

            });
            $('a#closeChangePass').click(function () {
                $('div.web').css("opacity", "1");
                $('div#divChangePass').css("display", "none");

                //                  $('#divDoiMK').toggle(1000);
            });

            $('div#divChangePass input[type=button]#btnChangePass').click(function () {

                var OldPass = $('#txtOldPass').val();
                var NewPass = $('#txtNewPass').val();
                var RePass = $('#txtRePass').val();
                var chkRePass = true;
                if (OldPass == "") {
                    $('span#spOldPass').css("display", "block");
                }
                if (NewPass == "") {
                    $('span#spNewPass').css("display", "block");
                }
                if (RePass == "") {
                    $('span#spRePass').css("display", "block");
                }


                var chkOldPass;
                if (OldPass != "" && NewPass != "" && RePass != "") {
                    $('div#divChangePass span').css("display", "none");

                    if (RePass != NewPass) {
                        $('span#spRePass').html("Xác nhận lại mật khẩu mới");
                        $('span#spRePass').css("display", "block");
                        chkRePass = false;
                    }
                    //check Exist OldPass
                    if (chkRePass == true) {
                        $.ajax({
                            type: "POST",
                            url: "/Page/DoiMatKhau.aspx",
                            data: { OldPass: OldPass, NewPass: NewPass },
                            success: function (data) {
                                if (data == "0") {
                                    alert("Mật khẩu không đúng");
                                    chkOldPass = false;

                                }
                                else {

                                    chkOldPass = true;
                                    alert("Đổi mât khẩu thành công");
                                    window.location.href = "index.aspx";
                                }

                            }
                        });

                    }
                    else {
                        return;
                    }

                }
            });

        });
            </script>
     
</div>
</center>
    </form>
</body>
</html>

